package cn.yougou.controller;


import cn.yougou.common.DtoUtil;
import cn.yougou.dto.Dto;
import cn.yougou.dto.Query;
import cn.yougou.pojo.YgSlideshow;
import cn.yougou.service.shopcart.YgSlideshowService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

/**
 * @auth 韩帅锋
 * @date 2021/1/13 14:48
 */
@RestController
@RequestMapping("adminslideshow")
public class YgSlideshowController {
    @Reference
    private YgSlideshowService ygSlideshowService;

    @PostMapping("slist")
    public Dto slist (@RequestBody Query query){
        //计算当前从多少条展示
        query.setPage((query.getPage()-1)*query.getLimit());
        //根据条件查询总条数赋值给query
        query.setInfoCount(ygSlideshowService.selCount(query));
        return DtoUtil.returnDataListSuccess(ygSlideshowService.queryLimit(query),query);
    }
}
